package test3_10;

public class Test1_elementExchange {
    public static void main(String[] args) {
        /*
        相邻两个元素交换 {1,2,5,6,7,9} -> {2,1,6,5,9,7}
         */
        int[] array = {1, 2, 5, 6, 7, 9};
        int t;
        for (int i = 0; i < array.length; i = i + 2) {
            t = array[i];
            array[i] = array[i + 1];
            array[i + 1] = t;
        }

        for (int x : array) {
            System.out.print(x + " ");
        }
    }
}
